import java.util.*;

public class Rule {
    private Symbol lhs;
    private List<Symbol> rhs;

    public Rule(Symbol inLhs, List<Symbol> inRhs) {
        lhs = inLhs;
        rhs = inRhs;
    }
    
    public Symbol lhs() {
        return lhs;
    }
    
    public List<Symbol> rhs() {
        return rhs;
    }
    
    public String toString() {
        String rhsStr = "";
        for (Symbol s : rhs) {
           rhsStr = rhsStr + " " + s;
        }
        return lhs+" ->"+rhsStr;
    }
     
    public boolean isNullRule() {
        return rhs.size()== 1 && rhs.get(0).equals(Symbol.EPSILON);
    }
}
